package com.briup.day06;

import java.util.Arrays;

public class Test_bubbleSort {
    public static void main(String[] args) {
        int[] arr=new int[]{8,7,6,4,5};
        bubbleSort(arr);
    }
    public static void bubbleSort(int[] arr){
        for(int i=0;i<arr.length;i++){
            for(int j=0;j<arr.length-1;j++){
                if(arr[j]>arr[j+1]){
                    arr[j]=arr[j]^arr[j+1];
                    arr[j+1]=arr[j]^arr[j+1];
                    arr[j]=arr[j]^arr[j+1];
                }
            }
        }
        System.out.println(Arrays.toString(arr));
    }
}
